package cn.anecansaitin.industrialization_expansion.client.event;

import cn.anecansaitin.industrialization_expansion.ModConstant;
import cn.anecansaitin.industrialization_expansion.common.entity.EntityRegister;
import cn.anecansaitin.industrialization_expansion.common.entity.ModItemEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

@Mod.EventBusSubscriber(modid = ModConstant.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ClientSetupEvent {
    public static final RegistryObject<EntityType<ModItemEntity>> MOD_ITEM_ENTITY = EntityRegister.ENTITY.register("mod_item_entity", () -> EntityType.Builder.<ModItemEntity>of(ModItemEntity::new, EntityClassification.MISC).sized(0.25F, 0.25F).clientTrackingRange(6).updateInterval(20).build("mod_item_entity"));

    @SubscribeEvent
    public static void RegistryEntityRender(FMLClientSetupEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(MOD_ITEM_ENTITY.get(), (m) -> new ItemRenderer(m, Minecraft.getInstance().getItemRenderer()));
    }
}
